import datetime

from pydantic import BaseModel, Field
from typing import Optional, List, Union

from module_admin.entity.vo.cms_car_vo import CarSimpleModel
from module_admin.entity.vo.cms_driver_vo import OrderListOrderChild, DriverSimpleModel


class CarTeamModel(BaseModel):
    # 必填
    id: Optional[int] = Field(None, primary_key=True)
    car_team_id: Optional[str] = Field(None, comment='车队编码')
    car_team_name: Optional[str] = Field(None, comment='车牌号')
    car_team_manager: Optional[str] = Field(None, comment='车队管理员')
    car_team_manager_phone: Optional[str] = Field(None, comment='车队管理员电话')
    remark: Optional[str] = Field(None, comment='说明')
    create_time: Optional[datetime.datetime] = Field(None, comment='创建时间')
    create_by: Optional[str] = Field(None, comment='创建人')
    update_time: Optional[datetime.datetime] = Field(None, comment='修改时间')
    update_by: Optional[str] = Field(None, comment='修改人')


class CarTeamForPage(BaseModel):
    id: Optional[int] = Field(None, primary_key=True)
    car_team_id: Optional[str] = Field(None, comment='车队编码')
    car_team_name: Optional[str] = Field(None, comment='车牌号')
    car_team_manager: Optional[str] = Field(None, comment='车队管理员')
    car_team_manager_phone: Optional[str] = Field(None, comment='车队管理员电话')
    remark: Optional[str] = Field(None, comment='说明')
    create_time: Optional[datetime.datetime] = Field(None, comment='创建时间')
    create_by: Optional[str] = Field(None, comment='创建人')
    update_time: Optional[datetime.datetime] = Field(None, comment='修改时间')
    update_by: Optional[str] = Field(None, comment='修改人')
    car_num: Optional[str] = Field(None, comment='车队车辆数量')
    driver_num: Optional[str] = Field(None, comment='车队驾驶员数量')


class CarTeamForQuery(BaseModel):
    car_team_name: Optional[str] = Field(None, title="车队名称")

class CarTeamPageObject(CarTeamForQuery):
    page_num: int
    page_size: int

class CarTeamForDetails(BaseModel):
    id: Optional[int] = Field(None, primary_key=True)
    car_team_id: Optional[str] = Field(None, comment='车队编码')
    car_team_name: Optional[str] = Field(None, comment='车牌号')
    car_team_manager: Optional[str] = Field(None, comment='车队管理员')
    car_team_manager_phone: Optional[str] = Field(None, comment='车队管理员电话')
    remark: Optional[str] = Field(None, comment='说明')
    create_time: Optional[datetime.datetime] = Field(None, comment='创建时间')
    create_by: Optional[str] = Field(None, comment='创建人')
    update_time: Optional[datetime.datetime] = Field(None, comment='修改时间')
    update_by: Optional[str] = Field(None, comment='修改人')
    car_list: Optional[List[CarSimpleModel]] = Field(None, comment='车辆信息')
    driver_list: Optional[List[DriverSimpleModel]] = Field(None, comment='驾驶员信息')

class CarTeamForDetailsBase(BaseModel):
    id: Optional[int] = Field(None, primary_key=True)
    car_team_id: Optional[str] = Field(None, comment='车队编码')
    car_team_name: Optional[str] = Field(None, comment='车牌号')
    car_team_manager: Optional[str] = Field(None, comment='车队管理员')
    car_team_manager_phone: Optional[str] = Field(None, comment='车队管理员电话')
    remark: Optional[str] = Field(None, comment='说明')
    create_time: Optional[datetime.datetime] = Field(None, comment='创建时间')
    create_by: Optional[str] = Field(None, comment='创建人')
    update_time: Optional[datetime.datetime] = Field(None, comment='修改时间')
    update_by: Optional[str] = Field(None, comment='修改人')
    cmsCar_id: Optional[int] = Field(None, primary_key=True)
    cmsCar_car_id: Optional[str] = Field(None, comment='车辆编码')
    cmsCar_car_number: Optional[str] = Field(None, comment='车牌号')
    cmsCar_car_department_name: Optional[str] = Field(None, comment='所属部门')
    cmsCar_car_type: Optional[str] = Field(None, comment='车辆类型')
    cmsCar_car_model: Optional[str] = Field(None, comment='车辆型号')
    cmsCar_car_brand: Optional[str] = Field(None, comment='车辆品牌')
    cmsDriver_id: Optional[int] = Field(None, primary_key=True)
    cmsDriver_driver_id: Optional[str] = Field(None, comment='驾驶员编码')
    cmsDriver_driver_name: Optional[str] = Field(None, comment='驾驶员姓名')
    cmsDriver_car_department_name: Optional[str] = Field(None, comment='所属部门')
    cmsDriver_driver_model: Optional[str] = Field(None, comment='准驾车型集合')
    cmsDriver_phone: Optional[str] = Field(None, comment='手机号')
